package com.yl.core.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;

@Slf4j
public class MyApplicationFailedListener implements ApplicationListener<ApplicationFailedEvent> {

    /**
     * springboot启动异常时执行事件
     * @param event
     */
    @Override
    public void onApplicationEvent(ApplicationFailedEvent event) {

        //log.error("springboot启动异常时执行事件【ApplicationFailedEvent】");
        System.out.println("ApplicationFailedEvent事件发布：" + event.getTimestamp());
    }
}
